import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "@/assets/css/common.scss"
// import { Button } from 'vant';
// import 'vant/lib/index.css';

// Vue.prototype.$message = Message;

Vue.config.productionTip = false
//test()方法和tt变量打印用Ctrl+Z快速调试
/* Vue.mixin({
  mounted() {
    if (this.test && typeof this.test == "function") {
      document.addEventListener("keydown", e => {
        if (e.ctrlKey && e.keyCode == 90) this.test();
      });
    }
    if (typeof this.tt != "undefined") {
      console.log(this.tt,"ttttttttttttttttttttttt");
      document.addEventListener("keydown", e => {
        if (e.ctrlKey && e.keyCode == 90) console.log(this.tt,"ttttttttttttttttttttttt");
      });
    }
  }

}) */
router.beforeEach((to, from, next) => {
  if (to.query.customtitle) {
    document.title = to.query.customtitle   //  动态设置标题
  } else {
    document.title = to.meta.title       //  常规设置 标题
  }
  next()
})
Vue.mixin({
    beforeRouteEnter(to, from, next){
      console.log("beforeRouteEnter:   "+to.path);
      next();
    },
    beforeRouteUpdate(to, from, next) {
      console.log("beforeRouteUpdate   "+to.path);
      next();
    },
    beforeRouteLeave(to, from, next) {
      console.log("beforeRouteLeave   "+from.path+"   "+to.path);
      next();
    },
  })
  
  window.onload = function () {
    document.addEventListener('touchstart', function (event) {
      if (event.touches.length > 1) {
        event.preventDefault()
      }
    })
    document.addEventListener('gesturestart', function (event) {
      event.preventDefault()
    })
  };
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
